package com.geen.tuoke.ui.viewmodel

import androidx.lifecycle.MutableLiveData
import com.geen.tuoke.base.BaseViewModel
import com.geen.tuoke.network.api.apiService
import com.geen.tuoke.network.utils.CacheUtil
import com.geen.tuoke.utils.ext.request
import com.geen.tuoke.utils.ext.toastShort

/**
 *
 * @Description: java类作用描述
 * @Author: geen
 * @CreateDate: 2022/1/18 22:35
 * @Version: 1.0
 */
class SplashViewModel : BaseViewModel() {

    var refreshSuccess = MutableLiveData<Boolean>()
    init {
        refreshToken()
    }
    private fun refreshToken(){
        request({ apiService.refreshToken()},{
            CacheUtil.saveToken(it.token)
            refreshSuccess.value = true
        },{
            refreshSuccess.value = false
        },true)
    }
}